<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>练习</title>
</head>

<body>
    <script>
        /*
        1. 1~10的和
        2. 5~12的和
        3. 14~35的和
        */
        /* function add(a, b) {
            var sum = 0 //声明变量
            for (var i = a; i <= b; i++) {
                sum += i
            }
            console.log(sum);
        }
        add(1, 10);
        add(5, 12);
        add(14, 35); */

        /*
        3!=3*2*1
        10!=10*9*8...*1
        */
        /* function jc(n) {
            var res = 1;
            for (var i = 1; i <= n; i++) {
                res *= i
            }
            return res;
        }
        console.log(jc(4)); */
    </script>
</body>

</html>